package com.ratta.supernote.note.plugincore.error;

/**
 * Plugin enabling error information
 */
public class EnablePluginException extends Throwable {
    public static enum EnablePluginExceptionCode {
        ERROR_UNKNOWN(200, "Unknown error"),
        ERROR_SIDE_BAR_TYPE(201, "Invalid sidebar entry type"),
        ERROR_SIDE_BAR_DEFAULT_OUT(202, "Too many sidebar items"),
        ERROR_SIDE_BAR_PEN_OUT(203, "Too many pen extension buttons"),
        ERROR_SIDE_BAR_ERASER_OUT(204, "Too many eraser extension buttons"),
        ERROR_SIDE_BAR_LAYER_OUT(205, "Too many layer extension buttons"),
        ERROR_SIDE_BAR_STYLE_OUT(206, "Too many template extension buttons"),
        ERROR_SIDE_BAR_THUMB_OUT(207, "Too many thumbnail extension buttons"),
        ERROR_EDIT_BAR_TYPE(208, "Invalid edit toolbar entry type"),
        ERROR_EDIT_BAR_PEN_OUT(209, "Too many pen stroke entries"),
        ERROR_EDIT_BAR_TITLE_OUT(210, "Too many title entries"),
        ERROR_EDIT_BAR_IMAGE_OUT(211, "Too many image entries"),
        ERROR_EDIT_BAR_TXT_OUT(212, "Too many text entries"),
        ERROR_EDIT_BAR_LINK_OUT(213, "Too many link entries");

        int code;
        String message;

        EnablePluginExceptionCode(int code, String message) {
            this.code = code;
            this.message = message;
        }

        public int getCode() {
            return code;
        }

        public String getMessage() {
            return message;
        }

    }

    private int errorCode;

    public EnablePluginException(EnablePluginExceptionCode errorCode) {
        super(errorCode.getMessage());
        this.errorCode = errorCode.getCode();
    }

    public EnablePluginException(int errorCode, String message) {
        super(message);
        this.errorCode = errorCode;

    }
}
